<?php 
include('./fun.php');
$conn=my_sql($cfg);
$re=adm_login();
if($re['err']=='no_login'){no_login();}

$sql='select * from '.$cfg['e'].'ts ';
$state=g('state');
if($state!=10){$state=1;}
$sql.=' where state="'.$state.'" ';

$page=g('page');if(!$page){$page=1;}
$page_num=20;$start=($page-1)*$page_num;
$sql.=' order by id desc limit '.$start.','.$page_num;
$l=db($sql);

?>
<style></style>
<hh><b>投诉&建议</b></hh>
<mm>
<index>
<?php 
$url=url_get(['page','state']);
echo '<a class="'.($state==1?'select':'').'" href="?'.$url.'&state=1">未完成</a>';
echo '<a class="'.($state==10?'select':'').'" href="?'.$url.'&state=10">已经完成</a>';
?>    
</index>

<?php 
if($l){
echo '<table>';
th(['logo','昵称','提交时间','消息','回复时间','图片','操作']);
foreach($l as $v){
$im='无图片';
if($v['img']){$im='';
$img=unserialize(out($v['img']));

foreach($img as $t){
$im.='<img src="'.$t['img_240'].'" style="width:100px">';
}

}    

echo '<tr>';
echo '<td width="50px"><img src="'.$v['logo'].'" style="width:36px;height:36px;border-radius:50%"></td>';
echo '<td>'.base64($v['nickname']).$v['id'].'</td>';
echo '<td>'.date('Y-m-d H:i',$v['date']).'</td>';
echo '<td>'.$v['msg'].'</td>';
echo '<td>'.($v['re_date']?date('Y-m-d H:i',$v['re_date']):'无回复').'</td>';
echo '<td>'.$im.'</td>';
echo '<td>
<a onclick="detail($(this))" i="'.$v['id'].'">详情</a>
</td>';
echo '</tr>';
}
echo '</table>';
}else{no_data();}

page();
?>

</mm>


<script>
function detail(o){
var id=o.attr('i');if(!id){msg('请指定消息');return;}
right({title:'投诉建议详情',url:'ts_jy_dtl.php?id='+id,width:'800px'})
}



</script>